#pragma once
#include "stdafx.h"

#include <d3d9.h>
#include <d3dx9.h>
//#include <dxerr9.h>

#define DIRECTINPUT_VERSION 0x0800
#include <dinput.h>



class GameIO
{
// FUNCTIONS
public:
	GameIO(HINSTANCE hinstance, HWND hwnd);
	~GameIO(void);
	int poll(void);
	int mouseDX(void);
	int mouseDY(void);
	int mouseDZ(void);
	D3DXVECTOR3 mouseDelta(void);
	int mouseButtonPressed(int button);
	bool keyDown(char key);

private:
	int initKeyboard(HWND hwnd, long CooperativeFlags);
	int initMouse(HWND hwnd, long CooperativeFlags);


// MEMBERS
private:

	// keyboard members
	IDirectInputDevice8* mKeyboardDev;  // keyboardDev
	unsigned char m_KeyboardState[256];	// keyboard state

	// mouse members
	IDirectInputDevice8* mMouseDev;  // mouse device
	DIMOUSESTATE mMouseState;		// mouse state

	// direct input interface
	static IDirectInput8* diCOM;
};
